<form [formGroup]="form">
  <ix-radio-group
    formControlName="schedule_method"
    [label]="helptext.scheduleMethodLabel | translate"
    [tooltip]="helptext.scheduleMethodTooltip | translate"
    [required]="true"
    [options]="scheduleMethodOptions$"
  ></ix-radio-group>
  @if (form.controls.schedule_picker.enabled) {
    <ix-scheduler
      formControlName="schedule_picker"
      [required]="true"
      [label]="helptext.scheduleLabel | translate"
      [tooltip]="helptext.scheduleTooltip| translate"
    ></ix-scheduler>
  }
  @if (form.controls.readonly.enabled) {
    <ix-checkbox
      formControlName="readonly"
      [label]="helptext.readonlyLabel | translate"
      [tooltip]="helptext.readonlyTooltip | translate"
    ></ix-checkbox>
  }
  <ix-radio-group
    formControlName="retention_policy"
    [label]="helptext.retentionPolicyLabel | translate"
    [tooltip]="helptext.retentionPolicyTooltip | translate"
    [required]="true"
    [options]="retentionPolicyOptions$"
  ></ix-radio-group>
  <div class="lifetime">
    @if (form.controls.lifetime_value.enabled) {
      <ix-input
        class="value"
        formControlName="lifetime_value"
        type="number"
        [required]="true"
      ></ix-input>
    }
    @if (form.controls.lifetime_unit.enabled) {
      <ix-select
        class="unit"
        formControlName="lifetime_unit"
        [options]="lifetimeUnitOptions$"
        [required]="true"
      ></ix-select>
    }
  </div>

  <ix-form-actions>
    <button
      mat-button
      matStepperPrevious
      ixTest="back"
    >{{ 'Back' | translate }}</button>
    <button
      *ixRequiresRoles="requiredRoles"
      mat-button
      type="button"
      color="primary"
      ixTest="save"
      [disabled]="form.invalid"
      (click)="onSave()"
    >{{ 'Save' | translate }}</button>
  </ix-form-actions>
</form>
